const mysql = require('mysql')

const Connection=mysql.createConnection({
    host:"localhost",
    user:"root",
    password:"root",
    database:"zhidi"
})
Connection.connect()
const mysqls = {
    query($sql,$params){
        return new Promise((resolve,reject)=>{
            Connection.query($sql,$params,(error,result)=>{
                if(error){
                    reject(error)
                }else{
                    resolve(result)
                }
            })
        })
    }
}
module.exports=mysqls